JavaScript

A5.chart.u.layoutposition Method

Syntax

A5.chart.u.layout.position(location,data,temp,settings[,asPercent])

Returns

positionobject

The resulting position.

topnumberstring

The top position. It should be noted that either "top" or "bottom" will be defined, not both.

bottomnumberstring

The bottom position. It should be noted that either "top" or "bottom" will be defined, not both.

leftnumberstring

The left position. It should be noted that either "left" or "right" will be defined, not both.

rightnumberstring

The left position. It should be noted that either "left" or "right" will be defined, not both.

anglenumber

If the chart type if "polar" or "radial" then the "angle" from the center of the chart is returned.

distancenumber

If the chart type if "polar" or "radial" then the "distance" from the center of the chart is returned.

Description

The layout position utility method is used to convert a location to a position on the chart plot area.

Discussion

When adding elements to the chart the position of the element will need to be calculated based on the chart axes and plot area. This method provides a way to convert a location (see A5.chart Definition Location Object) to a coordinate on the plot area.

Example

// assume a rectangular chart
// "x" axis of "A", "B" and "C", and a "y" axis of "0" to "50".
// chart plot area is 300 wide by 200 high.
var l = A5.chart.u.layout.position({x: 'B', y: 25},data,temp,settings);
// l = {top: 150, left: 100};
l = A5.chart.u.layout.position({x: 'B', y: 25},data,temp,settings);
// l = {top: '50%', left: '50%'};

Properties

locationobject

The location to get the position for. See A5.chart Definition Location Object.

dataobject

The chart render data object. See A5.chart Render Data Object.

tempobject

The chart render temporary object.

settingsobject

The chart settings object. See A5.chart.generate.

asPercentboolean

Return the position as a percentage instead of an absolute value. This is useful when positioning HTML over the chart SVG.